cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_CXX_STANDARD 17)

project(DemoProject)                     # 名字随意替换自己想要的

include_directories(src/include)
include_directories(lib/imgui)
include_directories("lib")


########
# GLFW #
########
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL " " FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL " " FORCE)
set(GLFW_BUILD_DOCS OFF CACHE BOOL " " FORCE)
set(GLFW_BUILD_INSTALL OFF CACHE BOOL " " FORCE)
set(GLFW_INSTALL OFF CACHE BOOL " " FORCE)
set(GLFW_USE_CHDIR OFF CACHE BOOL " " FORCE)
set(BUILD_SHARED_LIBS ON CACHE BOOL " " FORCE)

add_subdirectory(lib/glfw)

set_target_properties(glfw PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)

mark_as_advanced(
	GLFW_BUILD_DOCS GLFW_BUILD_EXAMPLES GLFW_BUILD_INSTALL GLFW_BUILD_TESTS
	GLFW_DOCUMENT_INTERNALS GLFW_INSTALL GLFW_USE_CHDIR GLFW_USE_MENUBAR
	GLFW_USE_OSMESA GLFW_VULKAN_STATIC GLFW_USE_RETINA GLFW_USE_MIR
	BUILD_SHARED_LIBS USE_MSVC_RUNTIME_LIBRARY_DLL
)

find_package(GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIRS})
set(GL_LIBRARIES GL ${GLEW_LIBRARIES} $<TARGET_OBJECTS:glfw_objects>)

include_directories("lib/glfw/include")

set(GL_SOURCES
    lib/imgui/imgui.cpp
    lib/imgui/imgui_demo.cpp
    lib/imgui/imgui_impl_glfw.cpp
    lib/imgui/imgui_impl_opengl3.cpp
    lib/imgui/imgui_draw.cpp
    lib/imgui/imgui_tables.cpp
    lib/imgui/imgui_widgets.cpp
    src/ImGuiFileDialog.cpp
)
add_library(cumgl STATIC ${GL_SOURCES})

# AUX_SOURCE_DIRECTORY(src DIR_SRCS)       # 源文件目录


add_executable(${PROJECT_NAME} src/main.cpp ) # “DemoProjecct”随意替换成自己想要的
target_link_libraries(${PROJECT_NAME} cumgl ${GL_LIBRARIES} -lglut -lGLU -ldl -pthread)